<!DOCTYPE html>
<html lang="en">
  <head>
    <meta charset="UTF-8" />
    <meta http-equiv="X-UA-Compatible" content="IE=edge" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
    <title>Document</title>
  </head>
  <body>
    <script>
      var arr = [
        { name: '郑00昊', height: 175, weight: 130 },
        { name: '李天成', height: 170, weight: 100 },
        { name: '梁恐爪', height: 178, weight: 120 },
        { name: '攀枝花', height: 170, weight: 160 },
      ];
      var obj = {
        a: 123,
      };
      Array.prototype.myforEach = function (func, par) {
        var len = this.length;
        var _this = arguments[1] || window;
        for (var i = 0; i < len; i++) {
          func.apply(_this, [this[i], i, this]);
          console.log(par);
        }
      };
      function forEachCallback(ele, index, arr) {
        console.log(ele, index, arr);
      }
      arr.myforEach(forEachCallback, obj);

      Array.prototype.myfilter = function (func, par) {
        var len = this.len;
        var _this = arguments[1] || window;
        var arr = [];
        for (var i = 0; i < len; i++) {
          func.apply(_this, [this[i], i, this]) && arr.push(this[i]);
        }
        return arr;
      };
      function myfilterCallcack(ele, index, arr) {
        var flag = true;
        if (ele.height >= 175) {
          return true;
        } else {
          return false;
        }
      }
      var filterArr = arr.myfilter(myfilterCallcack, obj);
      var newfilterArr = filterArr.myfilter(myfilterCallcack, obj);
    </script>
  </body>
</html>
